﻿using AF_Application.Interface.Specifications;
using AF_DataModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace AF_Application.Interface.Repertory
{
    public interface IRepertory : IDisposable
    {
        bool Add<T>(T entity, bool saveNow = true) where T : class,IDataModel;
        bool Add<T>(List<T> entityList, bool saveNow = true) where T : class,IDataModel;
        bool Update<T>(T entity, bool saveNow = true) where T : class,IDataModel;
        bool Update<T>(List<T> entityList, bool saveNow = true) where T : class,IDataModel;
        bool Delete<T>(T entity, bool saveNow = true) where T : class,IDataModel;
        bool Delete<T>(List<T> entityList, bool saveNow = true) where T : class,IDataModel;
        bool Delete<T>(Guid key, bool saveNow = true) where T : class,IDataModel;
        bool Delete<T>(List<Guid> keyList, bool saveNow = true) where T : class,IDataModel;
        int Count<T>() where T : class,IDataModel;
        int Count<T>(ISpecification<T> condition) where T : class,IDataModel;
        IQueryable<T> GetAll<T>(EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        IQueryable<T> GetAll<T>(Expression<Func<T, dynamic>> order, EnumSortType orderType, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        IQueryable<T> GetAll<T>(string order, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        PagedResult<T> GetAll<T>(Expression<Func<T, dynamic>> order, EnumSortType orderType, int pageIndex, int pageSize, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        PagedResult<T> GetAll<T>(string order, int pageIndex, int pageSize, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        T GetOne<T>(ISpecification<T> condition, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        T GetOne<T>(ISpecification<T> condition, Expression<Func<T, dynamic>> order, EnumSortType orderType, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        T GetOne<T>(ISpecification<T> condition, string order, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        IQueryable<T> Find<T>(ISpecification<T> condition, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        IQueryable<T> Find<T>(ISpecification<T> condition, Expression<Func<T, dynamic>> order, EnumSortType orderType, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        IQueryable<T> Find<T>(ISpecification<T> condition, string order, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        PagedResult<T> Find<T>(ISpecification<T> condition, Expression<Func<T, dynamic>> order, EnumSortType orderType, int pageIndex, int pageSize, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        PagedResult<T> Find<T>(ISpecification<T> condition, string order, int pageIndex, int pageSize, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        List<T> GetBySql<T>(string sql) where T : class,IDataModel;
        T GetByID<T>(Guid key, EnumQueryOption queryOption = EnumQueryOption.实时) where T : class,IDataModel;
        int ExecuteSql(string sql);
        object ExecuteScalar(string sql);
    }
}
